#include "proc.h"

double sum = 1024.0;
double speed = 1.0;

typedef void (*call_back)(double cur,double sum);

void UpLoad(call_back cb)
{
  double cur = 0;
  while(cur <= sum)
  {
    cb(cur,sum);
    usleep(3000);//下载数据中
    cur += speed;
  }

  printf("\nUpLoad %.2lfMB Done\n",cur);
}

void DownLoad(call_back cb)
{
  double cur = 0;
  while(cur <= sum)
  {
    cb(cur,sum);
    usleep(3000);//下载数据中
    cur += speed;
  }

  printf("\ndownload %.2lfMB Done\n",cur);
}

int main()
{
  DownLoad(Flushproc);
  DownLoad(Flushproc);
  UpLoad(Flushproc);
  
  return 0;
}

//void DownLoad()
//{
//  double cur = 0;
//  while(cur <= sum)
//  {
//    Flushproc(cur,sum);
//    usleep(3000);//下载数据中
//    cur += speed;
//  }
//
//  printf("\ndownload %.2lfMB Done\n",cur);
//}
//
//int main()
//{
//  DownLoad();
//  DownLoad();
//  
//  return 0;
//}
